home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
NCSA
/
tn3270 2.4d7 source
/
NCSA⁄BYU TCP⁄IP
/
atalk.c
next >
Wrap
Text File
|
1991-12-19
|
4KB
|
154 lines
#ifndef lint
static char *SCCSid = "%W% (NCSA) %G%";
#endif
/*
* atalk.c
* by Gaige B. Paulsen
****************************************************************************
* *
* Uses : *
* TCP/IP kernel for NCSA Telnet *
* by Tim Krauskopf *
* with Macintosh code by Gaige B. Paulsen *
* *
* National Center for Supercomputing Applications *
* 152 Computing Applications Building *
* 605 E. Springfield Ave. *
* Champaign, IL 61820 *
* *
* *
****************************************************************************
*
* Appletalk init and shutdown (and utility) procs.
*
* Called by:
* dlayer.c
* mactools.c
* macutil.c
*/
#include <stdio.h>
#include <AppleTalk.h>
#include <Dialogs.h>
#include <Devices.h>
#include "protocol.h"
#include "configrec.h"
#include "data.h"
#include "croft.h"
#include "mpw.h"
#include "maclook.h"
#include "menu.h"
typedef struct {
unsigned char node[26];
unsigned char net[2];
} ABusVarStruct, *ABusVarPtr, **ABusVarPtrPtr;
extern Listen();
extern char *KIPnameptr;
void getATaddress
(
int *hi,
int *low,
int *node
)
{
ABusVarPtr ABusVars;
ABusVarPtrPtr ABusPtrPtr = (ABusVarPtrPtr) 0x2d8L;
ABusVars = *ABusPtrPtr;
*hi = ABusVars->net[0];
*low = ABusVars->net[1];
*node = ABusVars->node[0];
}
int atopen
(
void
)
{
short err;
short socket=72, refnum, item;
ABusVarPtr ABusVars;
ABusVarPtrPtr ABusPtrPtr = (ABusVarPtrPtr) 0x2d8L;
char buffr[100];
DialogPtr dtemp;
MPPParamBlock pb;
err = 0;
#ifndef MPW
err = opendriver("\P.MPP",&refnum);
#else
err = OpenDriver("\P.MPP",&refnum);
#endif MPW
if (err == 0)
{
pb.DDPlistener = (Ptr) Listen;
pb.DDPsocket = socket;
err=POpenSkt(&pb, FALSE);
}
if (err != 0)
{
sprintf(buffr,"Failed Appletalk initialization (%d)\n",err);
putln(buffr);
#ifndef MPW
if (err == -91)
paramtext(0L, 0L, 0L, "\PCouldn't install Listener");
else if (err == -97 || err == -98)
paramtext(0L, 0L, 0L,
"\PYou forgot to turn on AppleTalk in the Chooser");
else if (err == -192)
paramtext(0L, 0L, 0L, "\PCouldn’t find ‘atpl’ resource");
else
paramtext(0L, 0L, 0L, "\PUnknown Error");
#else
if (err == -91)
paramtext(0L, 0L, 0L, "Couldn't install Listener");
else if (err == -97 || err == -98)
paramtext(0L, 0L, 0L,
"You forgot to turn on AppleTalk in the Chooser");
else if (err == -192)
paramtext(0L, 0L, 0L, "Couldn’t find ‘atpl’ resource");
else
paramtext(0L, 0L, 0L, "Unknown Error");
#endif MPW
dtemp = GetNewDialog(302, (Ptr) 0L, (WindowPtr) -1L);
ModalDialog(0L, &item);
DisposDialog(dtemp);
quit();
}
ABusVars = *ABusPtrPtr;
nnmyaddr[0] = ABusVars->net[0];
nnmyaddr[1] = ABusVars->net[1];
nnmyaddr[2] = ABusVars->node[0];
nnmyaddr[3] = 72;
sprintf(buffr,"Net : %d, Node : %d",*((unsigned short *)(&(ABusVars->net[0]))),(int)(ABusVars->node[0]));
putln(buffr);
return(0);
}
int atclose
(
void
)
{
MPPParamBlock pb;
pb.DDPsocket=72;
PCloseSkt(&pb, FALSE);
if (KIPnameptr)
KIPunregister();
return(0);
}